package com.bwie.utils;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;

/**
 * @BelongsProject: E-Commerce-Month-01
 * @BelongsPackage: com.bwie.utils
 * @Author: asus
 * @CreateTime: 2025-10-16  19:22
 * @Description: token 解析
 * @Version: 1.0
 */
public class JwtsUtils {

    public static Integer getIdByToken(String token){
        Claims claims = Jwts.parser().setSigningKey("bwie").parseClaimsJws(token).getBody();
        Integer userId = claims.get("userId", Integer.class);
        return userId;
    }
}
